package com.lego.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.lego.service.impl.SellerServiceImpl;

@WebServlet("/modifySeller.do")
public class ModifySellerInfoServlet extends HttpServlet{
	ObjectMapper om = new ObjectMapper();
	SellerServiceImpl ss=new SellerServiceImpl();
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			resp.setContentType("application/json;charset=utf-8");
			req.setCharacterEncoding("utf-8");
			String sellerPwd=req.getParameter("sellerPwd");
			int sellerId=0;
			try {
				sellerId=Integer.parseInt(req.getParameter("sellerId"));
			} catch (Exception e) {
				System.err.println("没有获取到ID");
			}
			int i=ss.editorSeller(sellerId, sellerPwd);
			if(i==1) {
				resp.getWriter().write(om.writeValueAsString(i));
			}
			
	}
}
